package com.llh.uua.conf.properties

import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.boot.context.properties.ConstructorBinding
import org.springframework.context.annotation.Configuration
import org.springframework.validation.annotation.Validated
import javax.validation.Valid
import javax.validation.constraints.Min

/**
 *
 *
 * Created At 2021/3/22 22:54
 * @author llh
 */
@Validated
@Configuration
@ConfigurationProperties(prefix = "app")
class AppProperties {
    @field:Valid
    var jwt: Jwt = Jwt()
}

class Jwt {

    var header: String = "Authorization"

    @field:Min(5000L)
    var accessExp: Long = 60 * 1000L // Access Token 过期时间

    @field:Min(36000L)
    var refreshExp: Long = 30 * 24 * 3600 * 1000L // Refresh Token 过期时间

    /**
     * 不可使用特殊符号
     */
    var accessKey: String = "hBRu1rI9GPQuIatzSoHqHiyyfcc2xc46iHX5U7miFBBvVteuYsf7NH55mMB6sD1t"
    /**
     * 不可使用特殊符号
     */
    var refreshKey: String = "MlEJV1fJ1sPMv6JS8ePAl3wsDzXZdiPl428zLvVizAMQ0nQpCJ9OTPcQiZsLzGcd"

    var appId :String = "xx-app"
}